<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 字符串方法 </title>
</head>
<body>
<h2>concat() 方法</h2>
<p>concat() 方法连接两个或多个字符串：</p>

<p id="demo"></p>
<script>
  var text1="Hello";
  var text2 = "World!";
  var text3=text1.concat("",text2);
  document.getElementById("demo").innerHTML=text3;
</script>

</body>
</html>

<!--
concat() 方法可用于代替加运算符。下面两行是等效的：
var text = "Hello" + " " + "World!";
var text = "Hello".concat(" ","World!");

注:字符串不可更改，只能替换
-->